App.controller('myInfoController', ['$rootScope', '$scope', '$state', '$window', 'Page', 'settings', 'sessionStore', function($rootScope, $scope, $state, $window, Page, settings, sessionStore) {
		$scope.user = angular.copy($rootScope.user);
		$scope.saveUser = function(){
			if($scope.user.realName == ''){
				$scope.msg = '用户姓名不能为空'; 
				return false;
			}
			if($scope.user.nikeName == ''){
				$scope.msg = '昵称不能为空'; 
				return false;
			}
			var param = {
				userId : $scope.user.userId,
				realName : $scope.user.realName,
				nikeName : $scope.user.nikeName
			};
			Page.ajaxPostQuiet(settings.updateUrl, param, function(resp) {
				Page.alert('用户信息修改成功!',function(){
					$rootScope.user.realName = param.realName;
					$rootScope.user.nikeName = param.nikeName;
					sessionStore.setObject('user', $rootScope.user);
					$state.reload();
				});
        	},function(resp){
        		$scope.msg = resp.resultDes; 
        	});
		};
}]);